<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/

Route::group(['middleware' => ['web']], function () {

    Route::get('menu',['as' => 'Home.Page.menu', 'uses' => 'HomeController@menu']);
    Route::get('content',['as' => 'Home.Page.content', 'uses' => 'HomeController@content']);

    Route::group(['prefix'=>'admin'],function(){
        Route::get('login',['as' => 'Admin.Home.login', 'uses' => 'AdminController@login']);
        Route::get('user-list',['as' => 'Admin.Home.userList', 'uses' => 'AdminController@userList']);
        Route::get('banner-list',['as' => 'Admin.Home.bannerList', 'uses' => 'AdminController@bannerList']);
        Route::get('banner-set',['as' => 'Admin.Home.bannerSet', 'uses' => 'AdminController@bannerSet']);
        Route::get('change-Pwd',['as' => 'Admin.Home.changePwd', 'uses' => 'AdminController@changePwd']);
        Route::get('admin-list',['as' => 'Admin.Home.adminList' , 'uses' => 'AdminController@adminList']);
        Route::get('admin-set',['as' => 'Admin.Home.adminSet' , 'uses' => 'AdminController@adminSet']);
        Route::get('classify-list',['as' => 'Admin.Home.classifyList' , 'uses' => 'AdminController@classifyList']);


    });

    Route::group(['prefix'=>'api', 'namespace'=>'Api','middleware' => ['cors']],function(){
        Route::group(['prefix' => 'admin','namespace'=>'Admin'],function(){
            Route::post('auth/sign-in',['as'=>'Api.Admin.Auth.signInAdmin','uses'=>'AuthController@signInAdmin']);
            Route::post('auth/change-pwd',['as'=>'Api.Admin.Auth.changePassword','uses'=>'AuthController@changePassword']);
            Route::get('auth/signOut',['as'=>'Api.Admin.Auth.signOut','uses'=>'AuthController@signOut']);
            Route::post('sys/setBanner',['as'=>'Api.Admin.sys.setBanner','uses'=>'SystemController@setBanner']);
            Route::post('sys/delBanner',['as'=>'Api.Admin.sys.delBanner','uses'=>'SystemController@delBanner']);
            Route::post('sys/setAdmin',['as' => 'Api.Admin.sys.setAdmin','uses' => 'SystemController@setAdmin']);
            Route::post('sys/delAdmin',['as'=>'Api.Admin.sys.delAdmin','uses'=>'SystemController@delAdmin']);
            Route::post('sys/addClassify',['as'=>'Api.Admin.sys.addClassify','uses'=>'SystemController@addClassify']);
            Route::post('sys/delClassify',['as'=>'Api.Admin.sys.delClassify','uses'=>'SystemController@delClassify']);

            Route::get('sys/getUserAnswerList',['as'=>'Api.Admin.sys.getUserAnswerList','uses'=>'SystemController@getUserAnswerList']);
            Route::post('sys/setScore',['as'=>'Api.Admin.sys.setScore','uses'=>'SystemController@setScore']);
            Route::get('sys/getUserQuestionAnswer',['as'=>'Api.Admin.sys.getUserQuestionAnswer','uses'=>'SystemController@getUserQuestionAnswer']);
            Route::get('sys/getLeaderBoard',['as'=>'Api.Admin.sys.getLeaderBoard','uses'=>'SystemController@getLeaderBoard']);

        });

        Route::group(['prefix' => 'wx'],function(){
            Route::any('getJsApiPacket',['as'=>'Api.Wechat.getJsApiPacket','uses'=>'WechatController@getJsApiPacket']);
        });

        Route::group(['prefix' => 'file'],function(){
            Route::post('upload-img',['as'=>'Api.File.upload','uses'=>'ImageController@upload']);
            Route::post('upload-audio',['as'=>'Api.File.uploadAudio','uses'=>'ImageController@uploadAudio']);
            Route::post('upload-video',['as'=>'Api.File.uploadVideo','uses'=>'ImageController@uploadVideo']);
            Route::get('show-image/{id}',['as'=>'Api.File.showImageById','uses'=>'ImageController@showImageById']);
            Route::get('show-video/{id}',['as'=>'Api.File.showVideoById','uses'=>'ImageController@showVideoById']);
            Route::get('reloadImages',['as'=>'Api.File.reloadImages','uses'=>'ImageController@reloadImages']);
            Route::post('uploadBase64Image',['as'=>'Api.File.uploadBase64Image','uses'=>'ImageController@uploadBase64Image']);
            Route::post('upload-user-photo',['as'=>'Api.File.uploadUserPhoto','uses'=>'ImageController@uploadUserPhoto']);
        });

        Route::group(['prefix' => 'audio'],function(){
            Route::get('upload-audio/{audio_id}',['as'=>'Api.Audio.getAudioUrl','uses'=>'AudioController@getAudioUrl']);
       });

        Route::group(['prefix' => 'auth'],function(){
            Route::get('wxLogin',['as'=>'Api.Auth.wxLogin','uses'=>'AuthController@wxLogin']);
            Route::get('goToUrl',['as'=>'Api.Auth.goToUrl','uses'=>'AuthController@goToUrl']);
            Route::any('wechatCallback',['as'=>'Api.Auth.wechatCallback','uses'=>'AuthController@wechatCallback']);
        });

        Route::group(['prefix' => 'other'],function(){
            Route::get('getBannerList',['as'=>'Api.Order.getBannerList','uses'=>'OtherController@getBannerList']);
        });

        Route::group(['prefix' => 'activity'],function(){
            Route::get('getActivityInfo',['as'=>'Api.Activity.getActivityInfo','uses'=>'ActivityController@getActivityInfo']);
            Route::post('activitySignUp',['as'=>'Api.Activity.activitySignUp','uses'=>'ActivityController@activitySignUp']);
            Route::post('jiashuju',['as'=>'Api.Activity.jiashuju','uses'=>'ActivityController@jiashuju']);

        });

        Route::group(['prefix' => 'answer'],function(){
            Route::get('getAnswerSheetList',['as'=>'Api.AnswerSheet.getAnswerSheetList','uses'=>'AnswerSheetController@getAnswerSheetList']);
            Route::get('getQuestionsList',['as'=>'Api.AnswerSheet.getQuestionsList','uses'=>'AnswerSheetController@getQuestionsList']);
            Route::post('answerAction',['as'=>'Api.AnswerSheet.answerAction','uses'=>'AnswerSheetController@answerAction']);
            Route::post('submitAnswer',['as'=>'Api.AnswerSheet.submitAnswer','uses'=>'AnswerSheetController@submitAnswer']);
            Route::get('getLeaderBoard',['as'=>'Api.AnswerSheet.getLeaderBoard','uses'=>'AnswerSheetController@getLeaderBoard']);
        });
    });
});
